package com.dylan.springcloud.consumerservice.controller;

import com.dylan.springcloud.consumerservice.service.UserService;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * Created by Dylan on 2018/10/18.
 */
@RestController
public class TestController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "/user/get/{username}", method = RequestMethod.GET)
    public String getUser(@PathVariable("username") String username) {
        return userService.getUser(username) + " " + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
    }
}
